package com.herench.bs.handler;

import com.herench.bs.agent.IOutpatientClinicAgent;
import com.herench.bs.annotation.Handler;
import com.herench.bs.support.AbstractMessageHandler;
import com.herench.bs.support.RequestMessage;
import com.herench.bs.support.ResponseMessage;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * Created by ThinkPad on 2018/5/9.
 *
 * 医保信息验证
 *
 */
@Component
@Handler(code = "100304" ,name="医保信息验证")
public class InsuranceInfoHandler  extends AbstractMessageHandler {
    @Override
    protected ResponseMessage innerHandler(RequestMessage requestMessage) throws Exception {
        ResponseMessage responseMessage = new ResponseMessage(requestMessage.getId());
        String channelCode = requestMessage.getArgsPropertyStringValue("sysCode");
        String idNo = requestMessage.getArgsPropertyStringValue("idNo");
        String insurNo = requestMessage.getArgsPropertyStringValue("insurNo");
        String password = requestMessage.getArgsPropertyStringValue("password");
        IOutpatientClinicAgent outpatientClinicAgent = getCleverClinicContext().getApplicationContext().getBean(IOutpatientClinicAgent.class);
        Map<String,Object> res = outpatientClinicAgent.insuranceInfo(channelCode,insurNo,password,idNo);
        responseMessage.setData(res);
        getPropertiesFromInvokerResultMap(responseMessage,res);
        return responseMessage;
    }
}
